LearningDataModel.CreateCorrectResponse Method

Creates a CorrectResponse object, which may then be used to be added to the Interaction.CorrectResponses list.

Parent Type: LearningDataModel

Namespace: Microsoft.LearningComponents.DataModel

Assembly: Microsoft.LearningComponents.dll

Syntax
C#

public CorrectResponse CreateCorrectResponse ()

Return Value

A new CorrectResponse object associated with this LearningDataModel.

Exceptions
Exception type Condition
InvalidOperationException

Thrown if this LearningDataModel object cannot be written to.

Example

The following example demonstrates creating a new correct response and adding it to the Interaction.CorrectResponses collection.

C#
LearningSession session = ... ; // get LearningSession object

CorrectResponse c = session.CurrentActivityDataModel.CreateCorrectResponse();
c.Pattern = "true";
session.CurrentActivityDataModel.Interactions[0].CorrectResponses.Add(c);